<template>
<div class="page-container">
    <div class="common-content">

        <!-- 列表搜索条件部分 label宽度要固定,优先展示输入框和下拉框 ;时间选择和地区选择放置在最后,因为后两个的尺寸表较大,换行后会导致整体对不齐 -->
        <div class="search-wrap">
            <el-form :inline='true' style="padding-top:20px" :model="searchFilters" :size="searchSize" ref="searchFilters"  label-position="right" label-width="100px">
              <!-- <el-form-item label="部门ID" prop="deptId" >
                <el-select clearable placeholder="选择部门" v-model="searchFilters.deptId">
                  <el-option v-for="(item,index) in deptList" :key="index" :label="item.name"
                             :value="item.id"></el-option>
                </el-select>
              </el-form-item> -->
                <el-form-item label="BD部门编码" >
                    <el-input v-model="searchFilters.code" placeholder="请输入名称"></el-input>
                </el-form-item>
                <el-form-item label="名称">
                    <el-input v-model="searchFilters.name" placeholder="请输入名称"></el-input>
                </el-form-item>
                <!-- <el-form-item label="汇率">
                    <el-input v-model="searchFilters.exchangeRate" placeholder="请输入汇率"></el-input>
                </el-form-item> -->
                <el-form-item label="负责人姓名">
                    <el-input v-model="searchFilters.chargeName" placeholder="请输入负责人姓名"></el-input>
                </el-form-item>
                <!-- <el-form-item label="负责人邮箱">
                    <el-input v-model="searchFilters.chargeEmail" placeholder="请输入负责人邮箱"></el-input>
                </el-form-item>
                <el-form-item label="负责人手机号">
                    <el-input v-model="searchFilters.chargePhone" placeholder="请输入负责人手机号"></el-input>
                </el-form-item>
                <el-form-item label="营业执照注册日期">
                    <el-date-picker v-model="searchFilters.businessLicenseRegistrationDate" type="datetime" placeholder="选择营业执照注册日期"></el-date-picker>
                </el-form-item>
                <el-form-item label="营业执照过期日">
                    <el-date-picker v-model="searchFilters.businessLicenseExpiryDate" type="datetime" placeholder="选择营业执照过期日" start-placeholder></el-date-picker>
                </el-form-item> -->
                <el-form-item label="企业性质">
                    <!-- <el-input v-model="searchFilters.enterpriseProperty" placeholder="请输入企业性质"></el-input> -->
                     <el-select v-model="searchFilters.enterpriseProperty" clearable placeholder="请选择企业性质">
                        <el-option label="有限责任公司（自然人独资）" :value="1"></el-option>
                        <el-option label="其他有限责任公司" :value="2"></el-option>
                        <el-option label="其他股份有限公司（非上市）" :value="3"></el-option>
                        <el-option label="有限责任公司（自然人投资或控股的法人独资）" :value="4"></el-option>
                        <el-option label="有限责任公司（法人独资）" :value="5"></el-option>
                        <el-option label="有限责任公司（自然人独资）" :value="6"></el-option>
                        <el-option label="有限责任公司" :value="7"></el-option>
                        <el-option label="分公司" :value="8"></el-option>
                        <el-option label="有限责任公司（自然人投资或控股）" :value="9"></el-option>
                        <el-option label="有限责任公司（外国法人独资）" :value="10"></el-option>
                        <el-option label="有限责任公司（台港澳合资）" :value="11"></el-option>
                        <el-option label="有限责任公司（自然人投资或控股）（1130）" :value="12"></el-option>
                        <el-option label="个人工商及其他" :value="13"></el-option>
                        <el-option label="外商独资" :value="14"></el-option>
                        <el-option label="民营企业" :value="15"></el-option>
                        <el-option label="上市公司" :value="16"></el-option>
                        <el-option label="国有企业" :value="17"></el-option>
                    </el-select>
                </el-form-item>
                <!-- <el-form-item label="法人姓名">
                    <el-input v-model="searchFilters.legalerName" placeholder="请输入法人姓名"></el-input>
                </el-form-item> -->
                <!--  <el-form-item label="法人证件类型">
                     <el-select v-model="searchFilters.legalerCertificateType" clearable placeholder="请选择类型">
                        <el-option label="港澳通行证" :value="1"></el-option>
                        <el-option label="护照" :value="2"></el-option>
                        <el-option label="士兵证" :value="3"></el-option>
                        <el-option label="军官证" :value="4"></el-option>
                        <el-option label="户口本" :value="5"></el-option>
                        <el-option label="身份证" :value="6"></el-option>
                    </el-select>
                </el-form-item>
               <el-form-item label="法人证件号码">
                    <el-input v-model="searchFilters.legalerCertificateNo" placeholder="请输入法人证件号码"></el-input>
                </el-form-item>
                <el-form-item label="证件过期日">
                    <el-date-picker v-model="searchFilters.legalerCertificateExpiryDate" type="datetime" placeholder="选择证件过期日"></el-date-picker>
                </el-form-item>
                <el-form-item label="法人证件照">
                    <el-input v-model="searchFilters.legalerCertificateImg" placeholder="请输入法人证件照"></el-input>
                </el-form-item>
                <el-form-item label="社会信用代码">
                    <el-input v-model="searchFilters.uniformSocialCreditCode" placeholder="请输入统一社会信用代码"></el-input>
                </el-form-item>
                <el-form-item label="注册资本(万):">
                    <el-input v-model="searchFilters.registeredCapital" placeholder="请输入注册资本（万元）"></el-input>
                </el-form-item> -->
               <el-form-item label="行业类型" prop="industryType">
                    <!-- <el-input v-model="dataForm.industryType" placeholder="请输入"></el-input> -->
                        <el-select v-model="searchFilters.industryType" clearable placeholder="请选择类型">
                        <el-option label="农业" :value="1"></el-option>
                        <el-option label="科技推广和应用服务业" :value="2"></el-option>
                        <el-option label="零售业" :value="3"></el-option>
                        <el-option label="批发业" :value="4"></el-option>
                        <el-option label="农副食品加工业" :value="5"></el-option>
                        <el-option label="食品制造业" :value="6"></el-option>
                        <el-option label="商务服务业" :value="7"></el-option>
                        <el-option label="银行证券保险支付等金融业）" :value="8"></el-option>
                    </el-select>
                </el-form-item>
                <!-- <el-form-item label="申请人ID">
                    <el-input v-model="searchFilters.applierId" placeholder="请输入申请人ID"></el-input>
                </el-form-item> -->
                <!-- <el-form-item label="审核状态">
                    <el-select v-model="searchFilters.sts" clearable placeholder="选择类型">
                        <el-option label="待审核" :value="0"></el-option>
                        <el-option label="审核通过" :value="1"></el-option>
                        <el-option label="审核拒绝" :value="2"></el-option>
                    </el-select>
                </el-form-item> -->
                <!-- 搜索区域按钮-查询,重置 -->
                <div class="tool-wrap">
                    <div class="left-area">
                        <el-button-group>
                            <el-button type="primary" size="small" @click="findPage()">查询</el-button>
                            <el-button type="primary" size="small" @click="resetForm()">重置</el-button>
                            <el-button type="primary" size="small" @click="addForm()">新增</el-button>
                            <el-button type="primary" size="small" @click="freezeApplicationForm(1)" >冻结</el-button>
                            <el-button type="primary" size="small" @click="thawApplicationForm(1)">解冻</el-button>
                            <el-button type="primary" size="small" @click="postponeApplyForm(1)">延期</el-button>
                            <el-button type="primary" size="small" @click="advanceApplyForm(1)">提前</el-button>
                            <el-button type="primary" size="small" @click="auditForm(1)" v-show="this.folg">审核</el-button>
                        </el-button-group>
                    </div>
                </div>
                  <el-tabs v-model="activeName" @tab-click="handleClick" >
                    <el-tab-pane label="已审核" name="first"></el-tab-pane>
                    <el-tab-pane label="预审核" name="second"></el-tab-pane>
                </el-tabs>
                <!-- 延期 -->
                 <el-dialog title="延期" :visible.sync="delayApply">
                    <el-form :model="form" ref="form" :rules="rules">
                    <el-form-item label="延期申请日期"  width="100%" prop="endTime">
                        <el-date-picker v-model="form.endTime" type="datetime" style="width: 15rem;"  placeholder="请选择结束日期"></el-date-picker>
                    </el-form-item>
                    <br>
                    <br>
                    <el-form-item label="延期原因"  width="100%"  prop="applyReason">
                        <el-input v-model="form.applyReason" style="width: 30rem;" type="textarea" auto-complete="off"  maxlength="150" show-word-limit></el-input>
                    </el-form-item>
                    </el-form>
                    <div slot="footer" class="dialog-footer">
                    <el-button @click="delayApply = false">取 消</el-button>
                    <el-button type="primary" @click="postponeApplyForm(2)">确 定</el-button>
                    </div>
                </el-dialog>
                <!-- 提前申请 -->
                <el-dialog title="提前申请" :visible.sync="advanceApply">
                    <el-form :model="form" ref="form" :rules="rules">
                    <el-form-item label="提前申请日期"  width="100%" prop="endTime">
                        <el-date-picker v-model="form.endTime" type="datetime" style="width: 15rem;"  placeholder="请选择结束日期"></el-date-picker>
                    </el-form-item>
                    <br>
                    <br>
                    <el-form-item label="提前申请原因"  width="100%"  prop="applyReason">
                        <el-input v-model="form.applyReason" style="width: 30rem;" type="textarea" auto-complete="off"  maxlength="150" show-word-limit></el-input>
                    </el-form-item>
                    </el-form>
                    <div slot="footer" class="dialog-footer">
                    <el-button @click="advanceApply = false">取 消</el-button>
                    <el-button type="primary" @click="advanceApplyForm(2)">确 定</el-button>
                    </div>
                </el-dialog>
                  <!-- 冻结 -->
                <el-dialog title="冻结" :visible.sync="freezeApplication">
                    <el-form :model="form" ref="form" :rules="rules">
                    <el-form-item label="申请状态"  width="100%" prop="sts">
                        <el-select v-model="form.sts" auto-complete="off">
                           <el-option label="流入正常,流出冻结" value="-1"></el-option>
                          <el-option label="流入冻结,流出正常" value="-2"></el-option>
                          <el-option label="双向冻结" value="-3"></el-option>
                        </el-select>
                    </el-form-item>
                    <br>
                    <br>
                    <el-form-item label="申请原因"  width="100%"  prop="applyReason">
                        <el-input v-model="form.applyReason" style="width: 30rem;" type="textarea" auto-complete="off"  maxlength="150" show-word-limit></el-input>
                    </el-form-item>
                    </el-form>
                    <div slot="footer" class="dialog-footer">
                    <el-button @click="freezeApplication = false">取 消</el-button>
                    <el-button type="primary" @click="freezeApplicationForm(2)">确 定</el-button>
                    </div>
                </el-dialog>
              <!-- 冻结  -->
                 <el-dialog title="解冻" :visible.sync="thawApplication">
                    <el-form :model="form" ref="form" :rules="rules">
                    <el-form-item label="申请状态"  width="100%" prop="sts">
                        <el-select v-model="form.sts" auto-complete="off">
                         <el-option label="启用" value="1"></el-option>
                        </el-select>
                    </el-form-item>
                    <br>
                    <br>
                    <el-form-item label="申请原因"  width="100%"  prop="applierReason">
                        <el-input v-model="form.applyReason" style="width: 30rem;" type="textarea" auto-complete="off"  maxlength="150" show-word-limit></el-input>
                    </el-form-item>
                    </el-form>
                    <div slot="footer" class="dialog-footer">
                    <el-button @click="thawApplication = false">取 消</el-button>
                    <el-button type="primary" @click="thawApplicationForm(2)">确 定</el-button>
                    </div>
                </el-dialog>
              <!-- 审核 -->
                  <el-dialog title="审核" :visible.sync="auditApplication">
                    <el-form :model="form" ref="form" :rules="rules">
                    <el-form-item label="审核状态"  width="100%" prop="auditSts">
                        <el-select v-model="form.auditSts" auto-complete="off">
                            <el-option label="审核通过" :value="1">审核通过</el-option>
                            <el-option label="审核拒绝" :value="2">审核拒绝</el-option>
                        </el-select>
                    </el-form-item>
                    <br>
                    <br>
                    <el-form-item label="审核原因"  width="100%"  prop="auditReason">
                        <el-input v-model="form.auditReason" style="width: 30rem;" type="textarea" auto-complete="off"  maxlength="150" show-word-limit></el-input>
                    </el-form-item>
                    </el-form>
                    <div slot="footer" class="dialog-footer">
                    <el-button @click="auditApplication = false">取 消</el-button>
                    <el-button type="primary" @click="auditForm(2)">确 定</el-button>
                    </div>
                </el-dialog>
                <!-- 表格数据部分 -->
                <div class="table-wrap">
                    <jic-table :height="350"
                     :operationWidth=300 :tableList="tableList"
                     :tableHeaderList="tableHeaderList" :totalSize="totalSize"
                     :showDetailOperation=true  :showEditOperation=true
                     :showBatchDelete=false :showSelection=true
                     :showIndex=false :showDeleteOperation=true
                     @findPage="findPage" @handleDetail="handleDetail"
                     @handleDelete="handleDelete" @handleEdit="handleEdit"
                     @handleSizeChange="handleSizeChange" @handlePageChange="handlePageChange"
                     @selectionChange="selectionChange"
                     ref="jicTable"></jic-table>
                    <!-- 审批界面 -->
                <!-- <el-dialog
                    title="审核核实"
                    width="30%"
                    :visible.sync="reviewFormVisible"
                    :close-on-click-modal="false"
                    >
                    <el-form
                        :model="searchFilters"
                        label-width="100px"
                        :rules="dataFormRules"
                        ref="searchFilters"

                    >
                        <el-row class="searchDialog-input">
                        <el-form-item label="审核状态：" prop="auditSts">
                        <el-select v-model="searchFilters.auditSts" style="width:100%">
                            <el-option label="审核通过" value="1">审核通过</el-option>
                            <el-option label="审核拒绝" value="2">审核拒绝</el-option>
                        </el-select>
                        </el-form-item>
                        <el-form-item label="审批原因："  prop="auditReason"  width="100%">
                        <el-input v-model="searchFilters.auditReason" type="textarea" auto-complete="off"
                        ></el-input>
                        </el-form-item>
                        </el-row>
                    </el-form>
                    <div slot="footer" class="dialog-footer" style="text-align:center">
                        <el-button  @click.native="reviewFormVisible = false">{{$t('action.cancel')}}</el-button>
                        <el-button

                        type="primary"
                        @click.native="reviewSuccess"
                        >{{$t('action.submit')}}</el-button>
                </div>
                </el-dialog>                    -->
                </div>
            </el-form>
        </div>
    </div>
    <!-- <el-dialog
  title="提示"
  :visible.sync="dialogVisible"
  width="30%"
  :before-close="handleClose">
<input></input>
  <span slot="footer" class="dialog-footer">
    <el-button @click="dialogVisible = false">取 消</el-button>
    <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
  </span>
</el-dialog> -->
</div>
</template>

<script>
//一.导包区
import jicTable from "@/components/jicComponentGallery/jicTable";

//二.数据输出区
export default {
  //===== 注册组件 =====
  components: {
    jicTable
  },

  //===== 数据初始化区=====
  data() {
    return {
      //===== 公共数据初始化 =====
      tabs: "1",
      reviewFormVisible: false,
      dialogVisible: false,
      deptList: [],
      selectionChangeList: [],
      pageIndex: 0, //当前页数：首页；
      pageSize: 10, //每页记录数：10条记录；
      totalSize: 0, //总记录数：返回数据总条数
      pageRequest: {
        pageNum: 1,
        pageSize: 10
      }, // 请求数据的参数
      freezeApplication: false, //冻结
      thawApplication: false, //冻结
      auditApplication: false, //审核
      tableList: [], // 表格列表数据
      searchSize: "mini",
      delayApply: false, //延期
      advanceApply: false, //提前申请
      activeName: "first", //默认查询主表
      selsts: null, //
      folg: null, //审核预审核标识按钮

      //=====表格表头数据=====
      tableHeaderList: [
        // {
        //     prop: "deptId",
        //     label: "部门ID",
        //     minWidth: 100,
        //     formatter: null
        // },
        {
          prop: "code",
          label: "编码",
          minWidth: 100,
          formatter: null
        },
        {
          prop: "name",
          label: "名称",
          minWidth: 100,
          formatter: null
        },
        {
          prop: "exchangeRate",
          label: "汇率",
          minWidth: 100,
          formatter: null
        },
        {
          prop: "chargeName",
          label: "负责人姓名",
          minWidth: 100,
          formatter: null
        },
        {
          prop: "chargePhone",
          label: "负责人手机号",
          minWidth: 100,
          formatter: null
        },
        {
          prop: "enterpriseProperty",
          label: "企业性质",
          minWidth: 100,
          formatter: function(row, column, enterpriseProperty, index) {
            if (enterpriseProperty == 0) {
              return "无";
            } else if (enterpriseProperty == 1) {
              return "有限责任公司（自然人独资）";
            } else if (enterpriseProperty == 2) {
              return "其他有限责任公司";
            } else if (enterpriseProperty == 3) {
              return "其他股份有限公司（非上市）";
            } else if (enterpriseProperty == 4) {
              return "有限责任公司（自然人投资或控股的法人独资）";
            } else if (enterpriseProperty == 5) {
              return "有限责任公司（法人独资）";
            } else if (enterpriseProperty == 6) {
              return "有限责任公司（自然人独资）";
            } else if (enterpriseProperty == 7) {
              return "有限责任公司";
            } else if (enterpriseProperty == 8) {
              return "分公司";
            } else if (enterpriseProperty == 9) {
              return "有限责任公司（自然人投资或控股）";
            } else if (enterpriseProperty == 10) {
              return "有限责任公司（外国法人独资）";
            } else if (enterpriseProperty == 11) {
              return "有限责任公司（台港澳合资）";
            } else if (enterpriseProperty == 12) {
              return "有限责任公司（自然人投资或控股）";
            } else if (enterpriseProperty == 13) {
              return "个人工商及其他";
            } else if (enterpriseProperty == 14) {
              return "外商独资";
            } else if (enterpriseProperty == 15) {
              return "民营企业";
            } else if (enterpriseProperty == 16) {
              return "上市公司";
            } else if (enterpriseProperty == 17) {
              return "国有企业";
            }
          }
        },
        {
          prop: "industryType",
          label: "行业类型",
          minWidth: 100,
          formatter: function(row, column, industryType, index) {
            if (industryType == 0) {
              return "无";
            } else if (industryType == 1) {
              return "农业";
            } else if (industryType == 2) {
              return "科技推广和应用服务业";
            } else if (industryType == 3) {
              return "零售业";
            } else if (industryType == 4) {
              return "批发业";
            } else if (industryType == 5) {
              return "农副食品加工业";
            } else if (industryType == 6) {
              return "食品制造业";
            } else if (industryType == 7) {
              return "商务服务业";
            } else {
              return "银行证券保险支付等金融业";
            }
          }
        }
      ],

      //=====搜索表单对应的数据对象初始化=====
      searchFilters: {
        id: null,
        deptId: null,
        code: null,
        name: null,
        total: null,
        available: null,
        frozen: null,
        exchangeRate: null,
        chargeName: null,
        chargeEmail: null,
        chargePhone: null,
        businessLicenseRegistrationDate: null,
        businessLicenseExpiryDate: null,
        businessLicenseImg: null,
        enterpriseProperty: null,
        legalerName: null,
        legalerCertificateType: null,
        legalerCertificateNo: null,
        legalerCertificateExpiryDate: null,
        legalerCertificateImg: null,
        uniformSocialCreditCode: null,
        registeredCapital: null,
        industryType: null,
        createTime: null,
        updateTime: null,
        creator: null,
        updater: null,
        deleteFlag: null,
        sts: null,
        applierId: null,
        applyReason: null,
        auditorId: null,
        auditReason: null,
        auauditFlag: null,
        auditSts: null
      },
      form: {
        id: null,
        sts: null, //
        applyReason: null, //冻结原因
        endtime: null, //
        auditSts: null,
        auditReason: null
      },
      rules: {
        sts: [{ required: true, message: "请选择该状态选项", trigger: "blur" }],
        applyReason: [
          { required: true, message: "请输入申请原因", trigger: "blur" }
        ],
        auditSts: [
          { required: true, message: "请选择审核状态", trigger: "blur" }
        ],
        auditReason: [
          { required: true, message: "请输入审批原因", trigger: "blur" }
        ],
        endTime: [{ required: true, message: "请选择时间", trigger: "blur" }]
      }
      //  operation: false, // true:冻结, false:解冻
      //  editDialogVisible: false, // 新增编辑界面是否显示
      //dialogVisible: false, //// 是否显示弹窗内容;
      //editDialogVisible1: false,//// 是否可编辑弹窗内容;
      //editLoading: false,////是否显示加载时动画效果;
    };
  },

  //===== 初始化页面调用方法(dom元素绑定后再执行初始化数据操作) =====
  mounted() {
    this.findPage();
    this.getDeptName();
  },

  //=====Vue.js 方法区=====
  methods: {
    getDeptName() {
      let this_ = this;
      //let param = this.dataForm;
      this.utils.request.DepartmentNameInquiry({}, function(res) {
        this_.deptList = res.data;
        console.log(this_.deptList);
      });
    },

    /*tabs函数 */
    handleClick(tab, event) {
      console.log(tab, event);
      this.findPage();
    },
    //冻结
    freezeApplicationForm(num) {
      if (num == 1) {
        let this_ = this;
        if (this_.selectionChangeList.length < 1) {
          this_.$message({ message: "必须选中一条数据", type: "warning" });
          return false;
        }
        this_.form.id = this_.selectionChangeList[0].id;
        this_.freezeApplication = true;
      } else if (num == 2) {
        let this_ = this;
        this_.$refs.form.validate(valid => {
          if (valid) {
            this.$confirm("确认提交吗？", "提示", {}).then(() => {
              let this_ = this;
              let params = {};
              if (this_.freezeApplication) {
                params = Object.assign({}, this.form);
                this.utils.request.freezeApplicationConfThirdPart(
                  params,
                  function(res) {
                    if (res.code == "0000") {
                      this_.dataForm = {};
                      this_.findPage(null);
                      this_.freezeApplication = false;
                      this_.$message({ message: "操作成功", type: "success" });
                    } else {
                      this_.$message({
                        message: "操作失败, " + res.msg,
                        type: "error"
                      });
                    }
                  }
                );
              }
            });
          }
        });
      }
    },
    //冻结
    thawApplicationForm(num) {
      if (num == 1) {
        let this_ = this;
        if (this_.selectionChangeList.length < 1) {
          this_.$message({ message: "必须选中一条数据", type: "warning" });
          return false;
        }
        this_.form.id = this_.selectionChangeList[0].id;
        this_.thawApplication = true;
      } else if (num == 2) {
        let this_ = this;
        this_.$refs.form.validate(valid => {
          if (valid) {
            this.$confirm("确认提交吗？", "提示", {}).then(() => {
              let this_ = this;
              let params = {};
              if (this_.thawApplication) {
                params = Object.assign({}, this.form);
                this.utils.request.thawApplicationConfThirdPart(
                  params,
                  function(res) {
                    if (res.code == "0000") {
                      this_.dataForm = {};
                      this_.findPage(null);
                      this_.thawApplication = false;
                      this_.$message({ message: "操作成功", type: "success" });
                    } else {
                      this_.$message({
                        message: "操作失败, " + res.msg,
                        type: "error"
                      });
                    }
                  }
                );
              }
            });
          }
        });
      }
    },
    //延期
    postponeApplyForm(num) {
      if (num == 1) {
        let this_ = this;
        if (this_.selectionChangeList.length < 1) {
          this_.$message({ message: "必须选中一条数据", type: "warning" });
          return false;
        }
        this_.form.id = this_.selectionChangeList[0].id;
        this_.delayApply = true;
      } else if (num == 2) {
        debugger;
        let this_ = this;
        this_.$refs.form.validate(valid => {
          if (valid) {
            this.$confirm("确认提交吗？", "提示", {}).then(() => {
              let this_ = this;
              let params = {};
              if (this_.delayApply) {
                params = Object.assign({}, this.form);
                this.utils.request.postponeApplyConfThirdPartApply(
                  params,
                  function(res) {
                    if (res.code == "0000") {
                      this_.dataForm = {};
                      this_.findPage(null);
                      this_.delayApply = false;
                      this_.$message({ message: "操作成功", type: "success" });
                    } else {
                      this_.$message({
                        message: "操作失败, " + res.msg,
                        type: "error"
                      });
                    }
                  }
                );
              }
            });
          }
        });
      }
    },
    //提前申请
    advanceApplyForm(num) {
      if (num == 1) {
        let this_ = this;
        if (this_.selectionChangeList.length < 1) {
          this_.$message({ message: "必须选中一条数据", type: "warning" });
          return false;
        }
        this_.form.id = this_.selectionChangeList[0].id;
        this_.advanceApply = true;
      } else if (num == 2) {
        debugger;
        let this_ = this;
        this_.$refs.form.validate(valid => {
          if (valid) {
            this.$confirm("确认提交吗？", "提示", {}).then(() => {
              let this_ = this;
              let params = {};
              if (this_.advanceApply) {
                params = Object.assign({}, this.form);
                this.utils.request.advanceApplyConfThirdPartApply(
                  params,
                  function(res) {
                    if (res.code == "0000") {
                      this_.dataForm = {};
                      this_.findPage(null);
                      this_.advanceApply = false;
                      this_.$message({ message: "操作成功", type: "success" });
                    } else {
                      this_.$message({
                        message: "操作失败, " + res.msg,
                        type: "error"
                      });
                    }
                  }
                );
              }
            });
          }
        });
      }
    },
    // 显示审核and提交
    auditForm(num) {
      let this_ = this;
      // this_.form.auditSts = 1;
      if (num == 1) {
        if (this_.selectionChangeList.length < 1) {
          this_.$message({ message: "必须选中一条数据", type: "warning" });
          return false;
        }
        this_.form.id = this_.selectionChangeList[0].id;
        this_.auditApplication = true;
      } else if (num == 2) {
        this_.$refs.form.validate(valid => {
          if (valid) {
            this.$confirm("确认提交吗？", "提示", {}).then(() => {
              let this_ = this;
              let params = {};
              if (this_.auditApplication) {
                params = Object.assign({}, this.form);
                for (let i = 0; i < this.selectionChangeList.length; i++) {
                  params.id = this.selectionChangeList[i].id;
                  this.utils.request.auditAubmitConfThirdPartApply(
                    params,
                    function(res) {
                      if (res.code == "0000") {
                        this_.dataForm = {};
                        this_.findPage(null);
                        this_.auditApplication = false;
                        this_.$message({
                          message: "操作成功",
                          type: "success"
                        });
                      } else {
                        this_.$message({
                          message: "操作失败,需审核预审核, " + res.msg,
                          type: "error"
                        });
                      }
                    }
                  );
                }
              }
            });
          }
        });
      }
    },

    //1.查询按钮：查询列表数据
    findPage(pageNum) {
      // 传过滤器的参数
      let this_ = this;
      this_.selsts = 0;
      if (this_.searchFilters === undefined || this_.searchFilters === null) {
        this_.searchFilters = {};
      }

      this_.searchFilters.pageNum =
        pageNum === null || pageNum === undefined
          ? this.pageRequest.pageNum
          : pageNum;
      this_.searchFilters.pageSize = this.pageRequest.pageSize;
      if (this_.activeName == "second") {
        this_.selsts = 1;
        this.utils.request.findConfPlatApplyformPage(
          this_.searchFilters,
          function(res) {
            if (res.code === "0000") {
              this_.tableList = res.data.list;
              this_.totalSize = Number(res.data.total);
            } else {
              this_.tableList = [];
              this_.totalSize = 0;
            }
          }
        );
      } else {
        this_.selsts = 0;
        this.folg = false;
        this.utils.request.findConfThirdPartPage(this_.searchFilters, function(
          res
        ) {
          if (res.code === "0000") {
            this_.tableList = res.data.list;
            this_.totalSize = Number(res.data.total);
          } else {
            this_.tableList = [];
            this_.totalSize = 0;
          }
        });
      }
    },

    // 2.重置按钮：无条件查询搜索框条件
    resetForm(formName) {
      this.searchFilters = {};
      this.findPage(null);
    },

    // 3.详情按钮对应的方法
    handleDetail(params) {
      this.$router.push({
        path: "/ConfThirdPartDetail/",
        query: {
          id: params.row.id,
          disabled: true,
          selsts: this.selsts,
          activeName: this.activeName
        }
      });
    },
    selectionChange(params) {
      this.selectionChangeList = params.selections;
    },

    // 4.编辑按钮对应的方法
    handleEdit(params) {
      this.$router.push({
        path: "/ConfThirdPartDetail/",
        query: {
          id: params.row.id,
          disabled: false,
          selsts: this.selsts,
          activeName: this.activeName
        }
      });
    },

    // 5.跳转到新增记录页面；
    addForm(params) {
      params = {
        row: {
          id: null
        }
      };
      this.$router.push({
        path: "/ConfThirdPartDetail/",
        query: {
          id: params.row.id,
          disabled: false,
          activeName: this.activeName
        }
      });
    },
    // 6.每页记录数发生变化
    handleSizeChange(params) {
      this.pageRequest.pageSize = params.size;
    },

    // 7.请求页数发生变化
    handlePageChange(params) {
      this.pageRequest.pageNum = params.number;
      this.findPage();
    },
    // 8.页面弹窗处理方法
    add() {
      this.dialogVisible = true;
    },

    // 9.关闭弹窗
    handleClose() {
      this.dialogVisible = false;
    },

    // 10.删除按钮：删除选中的记录
    handleDelete(data) {
      if (this.activeName == "first") {
        this.utils.request.deleteConfThirdPart(
          {
            id: data.row.id
          },
          res => {
            if (res.data) {
              this.$message({
                message: "删除成功",
                type: "success"
              });
              this.findPage();
            } else {
              this.$message({
                message: "删除失败",
                type: "warning"
              });
            }
          }
        );
      } else {
        this.utils.request.deleteConfThirdPartApply(
          {
            id: data.row.id
          },
          res => {
            if (res.data) {
              this.$message({
                message: "删除成功",
                type: "success"
              });
              this.findPage();
            } else {
              this.$message({
                message: "删除失败",
                type: "warning"
              });
            }
          }
        );
      }
    }
    //==========Vue.js自定义方法区==========
  }
};
</script>

<style lang="scss" scoped>
/* ele组件样式重置 */
.common-content {
  padding: 10px;
  box-sizing: border-box;

  .search-wrap /deep/ {
    .el-form-item__label {
      height: 32px;
      line-height: 32px;
    }

    .el-form-item__content {
      height: 32px;
      line-height: 32px;
      width: 150px;
    }

    .el-input--mini .el-input__inner {
      height: 32px;
      line-height: 32px;
    }

    .el-date-editor.el-input,
    .el-date-editor.el-input__inner {
      width: 150px;
    }
  }

  /* 多日期样式重置 */
  .el-dater /deep/ .el-form-item__content {
    width: 330px;
  }

  /* 通用工具部分样式 */
  .tool-wrap {
    width: 100%;
    height: auto;
    position: relative;
    overflow: hidden;

    .left-area {
      float: left;
      width: 50%;
      text-align: left;

      button {
        margin-right: 15px;
        border-radius: 5px;
      }
    }

    .right-area {
      float: right;
      width: 50%;
      text-align: right;
    }
  }

  /* 表格部分样式 */
  .table-wrap {
    width: 100%;
    max-height: 600px;
    margin-top: 20px;
  }

  /* 弹窗样式 */
  .dialog-wrap /deep/ .el-dialog__footer {
    text-align: center !important;
  }
}
</style>
